﻿//===============================================================================
// La Pomme d'Or Krystal Application
// Windows Presentation Foundation Composite Application 
//===============================================================================
// Copyright (c) Jérôme Piquot.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================

using System;
using System.ServiceModel;
using System.Collections.Generic;

namespace PJ.Data.WCF
{
    /// <summary>
    /// <see cref="IItemData">Item data</see> persistence provider interface
    /// </summary>
    /// <typeparam name="TIItemData"><see cref="IItemData">Item data</see> type</typeparam>
    [ServiceContract]
    public interface IItemWCFProvider<TIItemData> : IEntityWCFProvider<TIItemData>
        where TIItemData : IItemData
    {
        /// <summary>
        /// Global search of an item based on it's name (and other text fields depending on object type. Like address for partner object).
        /// </summary>
        /// <param name="sessionId">User session id</param>
        /// <param name="searchText">Search criteria</param>
        /// <param name="mode">Fetch mode <see cref="GetDataMode"/> </param>
        /// <returns>The list of found objects global id or null</returns>
        /// <exception cref="ArgumentNullException"><paramref name="searchText"/> can't be <see langref="null"/> or empty</exception>              
        [OperationContract]
        string[] Search(string sessionId, string searchText, int mode);

        /// <summary>
        /// Gets the <see cref="IItemData">Item data</see> from the data source
        /// </summary>
        /// <param name="sessionId">User session id</param>
        /// <param name="name">Entity Name</param>
        /// <param name="mode">Fetch mode <see cref="GetDataMode"/> </param>
        /// <returns>The <see cref="IItemData">Item data</see> instance</returns>
        /// <exception cref="ArgumentNullException"><paramref name="name"/> can't be <see langref="null"/> or empty</exception>
        /// <exception cref="DataNotFoundException">If no <see cref="IItemData">Item data</see> exists having Name property equal to <paramref name="name"/> and not in find mode</exception>
        [OperationContract]
        TIItemData GetByName(string sessionId, string name, int mode);


        /// <summary>
        /// Gets the <see cref="IItemData">Item data</see> from the data source
        /// </summary>
        /// <param name="sessionId">User session id</param>
        /// <param name="aliasName">Entity Alias</param>
        /// <param name="mode">Fetch mode <see cref="GetDataMode"/> </param>
        /// <returns>The <see cref="IItemData">Item data</see> instance</returns>
        /// <exception cref="ArgumentNullException"><paramref name="aliasName"/> can't be <see langref="null"/> or empty</exception>
        /// <exception cref="DataNotFoundException">If no <see cref="IItemData">Item data</see> exists having Alias property equal to <paramref name="aliasName"/> and not in find mode</exception>
        [OperationContract]
        TIItemData GetByAlias(string sessionId, string aliasName, int mode);

    }
}
